<%@ page language="java" pageEncoding="UTF-8"%>

<!DOCTYPE HTML>
<html>
  <head>
    <title>login</title>
	<jsp:include page="/util/head.jsp"></jsp:include>
	<script type="text/javascript">
		$(function(){
			
			var msg = '${message}';
			if(msg != ''){
				alert(msg);
			}
			
			var userName = getCookie('userName');
			var password = getCookie('password');
			if(userName!=null && password!=null){
				$('[name=userName]').val(userName);
				$('[name=password]').val(password);
				$('[name=rememberPwd]').prop('checked', true);
			}
			
			
			$('#aLogin').click(function(){
				$('#formLogin').submit();
				return false;
			});
			
			$('#formLogin').submit(function(){
				var userName = $('[name=userName]').val();
				var password = $('[name=password]').val();
				
				if(userName=='' || password==''){
					alert('你逗比嘛');
					return false;
				}
				
				if($('[name=rememberPwd]').prop('checked')){
					setCookie('userName', userName);
					setCookie('password', password);
				}
			});
			
		});
	</script>
  </head>
  
  <body>
    
    <div class="translucent" style="display:block;"></div>
    <div class="promptToast" id="divEdit" style="margin-left:-160px;margin-top:-125px;display:block;">
    	<div class="title">登录</div>
    	<div class="content">
    		<form action="/login.action" method="post" id="formLogin">
	    		<p class="item"><label>账号</label><input type="text" name="userName" class="inp"/></p>
	    		<p class="item"><label>密码</label><input type="password" name="password" class="inp"/></p>
	    		<p class="item">
	    			<label></label><input type="checkbox" name="rememberPwd" value="1"/>记住密码
	    			<a href="" style="position:absolute;right:20px;">忘记密码?</a>
	    		</p>
    		</form>
    	</div>
    	<div class="btns">
    		<a href="" class="aBtn" id="aLogin">登录</a>
    	</div>
    </div>
    
  </body>
</html>
